import { defineStore } from "pinia";
// import { createPinia } from "pinia";
import {store} from '../index.js'
// setup mode
export const useUserInfo = defineStore('userInfo',()=>{
		let user = ref({
			username:'',
			avator:'',
			account:''
		})
		
		// 设置用户信息
		function setUserInfo(username,avator,account){
			user.value.username = username
			user.value.avator = avator
			user.value.account = account
		}
		
		// 清除用户信息
		function clearUserInfo(){
			user.value.username = ''
			user.value.avator = ''
			user.value.account = ''
		}
		
		
		return  {
			user,
			setUserInfo,
			clearUserInfo
		}
})

// 组件外使用
export function useUserInfoHook(){
	return useUserInfo(store)
}